package Demo6;

import java.util.Arrays;

public class Solution {
    public static void main(String[] args) {
        int[] array = {8, 1, 2, 2, 3};
        int[] ret = smallerNumbersThanCurrent(array);
        System.out.println(Arrays.toString(ret));

    }

    public static int[] smallerNumbersThanCurrent(int[] nums) {
        int[] retArray = new int[nums.length];

        for (int i = 0;i<retArray.length;i++) {
            for (int k = 0; k < nums.length; k++) {
                if(nums[i]>nums[k]){
                    retArray[i]++;
                }
            }
        }
        return retArray;
    }
}
